package tree;

import java.util.List;
import tree.generator.MakeTree;
import tree.person.Person;
import tree.stream.ProperReader;
import tree.stream.XmlStream;


/** class use MakeTree to generate family tree */
public class StartMakeTree {


	/** Main method build new tree XML document */
	public static void main(String[] args) {

		/** property file */
		ProperReader pr = new ProperReader("config");
		
		/** population in one tree */
		long population = Integer.parseInt(pr.getProperty("population"));
		/** number off tree */
		long treeNumber = Integer.parseInt(pr.getProperty("tree.number"));
		/** XML file path and name */
		String xmlFile = pr.getProperty("tree.file");


		/** generate tree */
		MakeTree makeTree = new MakeTree(population, treeNumber);
		makeTree.start();


		/** save to list */
		List<Person> tree = makeTree.getTree();


		/** XML file make */
		XmlStream xmlSchema = new XmlStream();
		xmlSchema.addList(tree);
		xmlSchema.save(xmlFile);
		
	}
}
